package com.accelstack.cmp.repository;

import com.accelstack.cmp.entity.ResourceUsage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * 资源使用监控Repository
 */
@Repository
public interface ResourceUsageRepository extends JpaRepository<ResourceUsage, Long> {
    
    /**
     * 根据虚拟化主机ID查询资源使用记录
     */
    List<ResourceUsage> findByVirtHostId(Long virtHostId);
    
    /**
     * 根据虚拟化主机ID和时间范围查询资源使用记录
     */
    List<ResourceUsage> findByVirtHostIdAndSampleTimeBetween(Long virtHostId, Date startTime, Date endTime);
}

